//
//  UIBarButtonItem+Extension.swift
//  SwiftWB
//
//  Created by 钟清 on 17/3/26.
//  Copyright © 2017年 Zhong Qing. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    convenience init(imageName : String, target: AnyObject?, action: Selector) {
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        btn.setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        btn.sizeToFit()
        btn.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
        self.init(customView: btn)
    }
}
